namespace AltNetUK.Models
{
    using System;
    using System.Text;
    using System.Xml.Serialization;
    using SimpleWebServices.Data;

    [XmlRoot(ElementName = "registration")]
    public sealed class Registration : IPersistable
    {
        [XmlIgnore]
        string IPersistable.Entity
        {
            get
            {
                StringBuilder buffer = new StringBuilder();
                buffer.Append(this.AltNetBeers);
                buffer.Append('\0');
                buffer.Append(this.AltNetConference);
                buffer.Append('\0');
                buffer.Append(this.Complete);
                buffer.Append('\0');
                buffer.Append(this.Email);
                buffer.Append('\0');
                buffer.Append(this.Message);
                buffer.Append('\0');
                buffer.Append(this.Name);
                buffer.Append('\0');
                buffer.Append(this.OpenSpaceCoding);
                buffer.Append('\0');
                buffer.Append(this.Twitter);

                return buffer.ToString();
            }
        }

        [XmlIgnore]
        Uri IPersistable.Identifier
        {
            get;
            set;
        }

        [XmlIgnore]
        Guid? IPersistable.Unique
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "complete")]
        public bool Complete
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "altnetbeers")]
        public bool AltNetBeers
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "altnetconf")]
        public bool AltNetConference
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "openspacecode")]
        public bool OpenSpaceCoding
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "email")]
        public string Email
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "name")]
        public string Name
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "message")]
        public string Message
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "twitter")]
        public string Twitter
        {
            get;
            set;
        }
    }
}